﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Web.Master" AutoEventWireup="true" CodeBehind="AdministracionProductos.aspx.cs" Inherits="SalaDeEnsayo.WebApplication.AdministracionProductos" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ MasterType VirtualPath="~/Web.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMaster" runat="server">
        <asp:Panel ID="pnlGrupos" runat="server" GroupingText="Productos">
        <div style="height:400px; width:100%; margin-left:150px;">
            <div>
                <table class="detalle" style="margin-left:120px;">
                    <tr>
                        <td><div style=" margin-top:10px;"><asp:Label ID="lblDesc" runat="server" Text="Descripción"></asp:Label></div></td>
                        <td><div style=" margin-top:10px;"><asp:TextBox ID="txtBuscar" runat="server" Width="300px"></asp:TextBox></div></td>
                        <td><div class="detalle2" style="width:240px; float:left; margin-top:10px;">
                                <asp:Button ID="btnBuscar" runat="server" Text="Buscar" 
                                    onclick="btnBuscar_Click" CausesValidation="false" />
                                <%--<input id="btnAgregar" type="button" value="Agregar" onclick="Populate();"/>--%>
                                <asp:Button ID="btnAgregar" runat="server" Text="Agregar" 
                                    onclick="btnAgregar_Click" CausesValidation="false"/>
                            </div>
                        </td>
                    </tr>    
                    
                </table>
            </div>
            <asp:GridView ID="grdProducto" runat="server" AllowPaging="true" 
                AlternatingRowStyle-CssClass="alt" AutoGenerateColumns="false" CellPadding="3" 
                CssClass="mGrid" DataKeyNames="Id_Producto" HeaderStyle-ForeColor="White" 
                HeaderStyle-HorizontalAlign="Center" 
                onpageindexchanging="grdProducto_PageIndexChanging" 
                onselectedindexchanged="grdProducto_SelectedIndexChanged" 
                PagerSettings-Mode="NumericFirstLast" PagerStyle-CssClass="pgr" PageSize="10" 
                RowStyle-VerticalAlign="Middle" ShowHeader="true" Width="700">
                <PagerStyle CssClass="pgr" />
                <EmptyDataTemplate>
                    No se encontraron datos de Productos.
                </EmptyDataTemplate>
                <PagerSettings Mode="NumericFirstLast" />
                <RowStyle VerticalAlign="Middle" />
                <Columns>
                    <asp:BoundField DataField="Id_Producto" HeaderText="Id" 
                        ItemStyle-HorizontalAlign="Right" ItemStyle-Width="80" 
                        SortExpression="Id_Producto" >
                        <ItemStyle HorizontalAlign="Right" Width="80px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Descripcion" HeaderText="Descripcion" 
                        ItemStyle-Width="300" SortExpression="Descripcion" >
                        <ItemStyle Width="300px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="descripcionT" HeaderText="Tipo" ItemStyle-Width="300" 
                        SortExpression="TipoP" >
                        <ItemStyle Width="300px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Costo" HeaderText="Costo" ItemStyle-Width="300" 
                        SortExpression="Costo" >
                        <ItemStyle Width="300px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Precio_Venta" HeaderText="Precio" 
                        ItemStyle-Width="300" SortExpression="Precio_Venta" >
                        <ItemStyle Width="300px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Cantidad" HeaderText="Cantidad" 
                        ItemStyle-Width="300" SortExpression="Cantidad" >
                        <ItemStyle Width="300px" />
                    </asp:BoundField>
                    <asp:TemplateField ItemStyle-Width="30px" Visible="true">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnModificar" runat="server" CausesValidation="false" 
                                CommandArgument='<%# Eval("Id_Producto") %>' ImageUrl="~/Images/Modificar.gif" 
                                OnClick="btnModificar_Click" ToolTip="Selecccionar" />
                        </ItemTemplate>
                        <ItemStyle Width="30px" />
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="30px" Visible="true">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnEliminar" runat="server" CausesValidation="false" Width="15" Height="15"
                                CommandArgument='<%# Eval("Id_Producto") %>' ImageUrl="~/Images/prod_delete.jpg" 
                                OnClick="btnEliminar_Click" ToolTip="Eliminar" />
                        </ItemTemplate>
                        <ItemStyle Width="30px" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle ForeColor="White" HorizontalAlign="Center" />
                <AlternatingRowStyle CssClass="alt" />
            </asp:GridView>
            <div style="float:left;">
            </div>
        </div>
    </asp:Panel>
    <asp:Panel ID="pnlDetalle" runat="server" GroupingText="Detalle">
        <div>
            <table class="detalle">
                <tr>
                    <td>
                        <label for="Tipo">Id:</label>
                    </td>
                    <td>                   
                        <asp:TextBox ID="txtId_Producto" runat="server" Enabled="false"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                         <label for="Tipo">Tipo:</label>
                    </td>
                    <td>
                         <asp:DropDownList ID="ddlTipo" runat="server" DataTextField="Descripcion" DataValueField="Id_Tipo">
                        </asp:DropDownList>
                         <asp:Label ID="lblVTipo" runat="server" ForeColor="Red" Text="*"></asp:Label>
                    </td>
                    <td>
                        <label for="Descripcion">Descripci&oacute;n:</label>
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtDescripcion" runat="server" Width="300" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtDescripcion" ErrorMessage="*"></asp:RequiredFieldValidator>
                    </td>
                    
                </tr>
                <tr>
                    <td>
                        <label for="Nombre">Costo:</label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtCosto" runat="server"></asp:TextBox>
                        <cc1:MaskedEditExtender ID="maskEditCosto" runat="server" TargetControlID="txtCosto"
                         MaskType="Number" Mask="999.99">
                        </cc1:MaskedEditExtender>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtCosto" ErrorMessage="*"></asp:RequiredFieldValidator>
                   </td>
                   <td>
                        <label for="Nombre">Precio:</label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtPrecio" runat="server"></asp:TextBox>
                        <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtPrecio"
                         MaskType="Number" Mask="999.99">
                        </cc1:MaskedEditExtender>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                            ControlToValidate="txtPrecio" ErrorMessage="*"></asp:RequiredFieldValidator>
                   </td>
                   <td>
                        <label for="Nombre">Cantidad:</label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtCant" runat="server" ontextchanged="TextCant_TextChanged"></asp:TextBox>
                        <cc1:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtCant"
                         MaskType="Number" Mask="999">
                        </cc1:MaskedEditExtender>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                            ControlToValidate="txtCant" ErrorMessage="*"></asp:RequiredFieldValidator>
                   </td>
                </tr>
         
            </table>            
        </div>
        <div class="detalle2">
        <asp:Button ID="btnGuardar" runat="server" Text="Guardar" Visible="false"
            onclick="btnGuardar_Click" />
        <asp:Button ID="btnActualizar" runat="server" Text="Guardar Modif." Visible="false"
            onclick="btnActualizar_Click" />
        <asp:Button ID="btnConfirmEliminar" runat="server" Text="Eliminar" Visible="false"
            onclick="btnConfirmEliminar_Click1" />
        <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" 
                onclick="btnCancelar_Click" CausesValidation="false" />
        </div>
    </asp:Panel>
   
</asp:Content>